package com.example.myapplication.base;

import android.content.Context;
import android.support.constraint.BuildConfig;

import com.molichuxing.baselibrary.net.OkHttpManager;
import com.molichuxing.baselibrary.utils.DeviceUtiles;
import com.molichuxing.baselibrary.utils.TimeUtils;

import java.util.ArrayList;

public class UrlManager {
    //本地接口
//    public static final String BaseUrl = "http://172.20.35.135:8084";//支付所需设备信息获取

    //旧测试
//    public static final String BaseUrl = "http://192.168.3.98:8080";//根接口192.168.3.98:8080
//    public static final String BaseUrl2 = "http://192.168.3.99:8080";//根接口
//    public static final String Personlive = BaseUrl2+"/apicenter/api/verifyIdentity";//人脸识别认证

    //新测试
    public static final String BaseUrl = "http://192.168.3.92:8082";//根接口192.168.3.98:8080
    public static final String BaseUrl2 = "http://192.168.3.95:8081";//根接口
    public static final String Personlive = BaseUrl2+"/apicenter/api/verifyIdentity";//人脸识别认证
    public static final String BaseH5Url = "http://mtest.molichuxing.com/contract-moli";//h5根接口

    //预发布
//    public static final String BaseUrl = "http://192.168.3.99:8082";//根接口192.168.3.98:8080
//    public static final String BaseUrl2 = "http://192.168.3.96:8081";//第三方根接口
//    public static final String Personlive = BaseUrl2+"/apicenter/api/verifyIdentity";//人脸识别认证
//    public static final String BaseH5Url = "http://mpre.molichuxing.com/contract-moli";//h5根接口

    //演示环境
//    public static final String BaseUrl = "http://app-apidemo.molichuxing.com";//根接口192.168.3.98:8080
//    public static final String BaseUrl2 = "http://com-apidemo.molichuxing.com";//第三方根接口
//    public static final String Personlive = BaseUrl2+"/apicenter/api/verifyIdentity";//人脸识别认证
//    public static final String BaseH5Url = "http://mdemo.molichuxing.com/contract-moli";//h5根接口

    //生产
//    public static final String BaseUrl = "https://app-api.molichuxing.com";//根接口192.168.3.98:8080
//    public static final String BaseUrl2 = "https://com-api.molichuxing.com";//第三方根接口
//    public static final String Personlive = BaseUrl2+"/apicenter/api/verifyIdentity";//人脸识别认证
//    public static final String BaseH5Url = "https://m.molichuxing.com/contract-moli";//h5根接口

    //h5路径
    public static final String CarDetail = BaseH5Url + "/turncar.html";//车辆交接检验单
    public static final String ContractCar_Once = BaseH5Url + "/lease-once.html";//汽车租赁合同-全款
    public static final String ContractCar_Lease = BaseH5Url + "/lease-by.html";//汽车租赁合同-分期
    public static final String ContractCar_Rent = BaseH5Url + "/ensure.html";//保证合同
    public static final String Credit = BaseH5Url + "/credit.html";//证信授权
    public static final String User_Read = BaseH5Url + "/user.html";//用户服务协议
    public static final String Rent_Read = BaseH5Url + "/guarantee.html";//担保须知
    public static final String Privacy = BaseH5Url + "/privacy.html";//隐私政策

    //url
    public static final String GetDeviceInfo = BaseUrl+"/union-pay-param/getByCpuSerial";//支付所需设备信息获取
    public static final String PersonInfo = BaseUrl2 + "/apicenter/api/verifyThreefactor";//身份认证三要素接口
    public static final String upload = BaseUrl2 + "/apicenter/zip/uploadFile";//人脸识别数据上传
    public static final String RegisterTwo = BaseUrl2 + "/apicenter/sign/eleSignRegister";//用户注册
    public static final String DRIVER = BaseUrl2 + "/apicenter/api/getDrivingLicense";//驾驶证校验
    public static final String AD = BaseUrl + "/ad";//广告接口获取全部广告信息
    public static final String APP = BaseUrl + "/app/update";//app管理接口app升级管理校验
    public static final String APPNEW = BaseUrl + "/app/updateNew";//app管理接口app升级管理校验
    public static final String GETCODE = BaseUrl + "/authcode/getSmsAuthCode";//获取验证码
    public static final String CHECKCODE = BaseUrl + "/authcode/validateAuthCode";//验证当前验证码
    public static final String WORKERLOGIN = BaseUrl + "/auth/employee-valid-login";//业务顾问登录
    public static final String GETRENTTYPEINFO = BaseUrl + "/rent/get-rent-car-info";//获取租车车型信息
    public static final String PERSONAL = BaseUrl + "/auth/personal";//用户身份认证
    public static final String CREIDT = BaseUrl + "/auth/collect-creidt";//个人证信认证
    public static final String RantConfirm = BaseUrl + "/rent/confirm-contract";//rent/confirm-contract
    public static final String RantConfirmAssure = BaseUrl + "/rent/guarantee-confirm-contract";//rent/guarantee-confirm-contract
    public static final String Register = BaseUrl + "/user/register";//用户注册
    public static final String LOGIN = BaseUrl + "/user/login";//用户登录
    public static final String DOCUMENT = BaseUrl + "/delivery/delivery-document";// 生成车交单
    //    public static final String SUCCESS = BaseUrl+"/delivery/success"; //获取业务办理成功信息
    public static final String HOME = BaseUrl + "/home/menu"; //获取首页菜单
    public static final String getTheCar = BaseUrl + "/delivery/not-deliver-order";//获取待交车的订单列表和车辆交接检验单
    public static final String PAY = BaseUrl + "/pay/order-pay"; //订单支付
    public static final String PAYMENT = BaseUrl + "/pay/pay-order-info";//获取订单支付信息
    public static final String CALLBACK = BaseUrl + "/pay/success-callback";//支付成功的回调
    public static final String FAILEDBACK = BaseUrl + "/pay/pay-failure";//支付失败的回调
    public static final String CONTRACT_GET = BaseUrl + "/rent/contract";//获取合同内容-GET
    public static final String CONTRACT_POST = BaseUrl + "/rent/contract";//生成合同-POST
    public static final String ORDER = BaseUrl + "/rent/create-order";//生成订单信息
    public static final String SearchCarCard = BaseUrl + "/delivery/license-plate-numbers";//模糊查询车牌信息
    public static final String AUTHORIZATION = BaseUrl + "/rent/credit-authorization";//获取征信授权书
    public static final String GETCARS = BaseUrl + "/rent/getcars"; //getcars
    public static final String BUSINESSTYPE = BaseUrl + "/rent/products/{businesstype}";//车辆获取产品信息
    public static final String AGREEMENT = BaseUrl + "/rent/user-agreement"; //获取用户须知
    public static final String USER = BaseUrl + "/user"; //获取全部用户

    public ArrayList<OkHttpManager.Param> getHeader(Context mContext, ArrayList<OkHttpManager.Param> params) {
        ArrayList<OkHttpManager.Param> heads = new ArrayList<OkHttpManager.Param>();

        //获取渠道号
        heads.add(new OkHttpManager.Param("chaVersion",
                DeviceUtiles.getAppMetaData(mContext,"CHANNEL")));
//        heads.add(new OkHttpManager.Param("channelVersion",
//                DeviceUtiles.getAppMetaData(mContext,"CHANNEL")));
        heads.add(new OkHttpManager.Param("opVersion", DeviceUtiles.getSystemVersion()));
        heads.add(new OkHttpManager.Param("appversion", BuildConfig.VERSION_NAME));//app版本号
        heads.add(new OkHttpManager.Param("timestamp", TimeUtils.getTime() + ""));//时间戳
        if (params != null) {
            for (OkHttpManager.Param pa : params) {
                heads.add(pa);
            }
        }
        return heads;
    }

    public ArrayList<OkHttpManager.Param> getHeader(Context mContext) {
        return getHeader(mContext,null);
    }

}
